﻿namespace Smark.Core
{
    using System;
    using System.Diagnostics;

    public abstract class Performance : IPerformance
    {
        protected Performance()
        {
        }

        public long Execute(int count)
        {
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Reset();
            stopwatch.Start();
            for (int i = 0; i < count; i++)
            {
                this.OnExecute();
            }
            stopwatch.Stop();
            return stopwatch.ElapsedMilliseconds;
        }

        protected abstract void OnExecute();
    }
}

